﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Knockout: Anonymous and Script Template</title>
    <link href="/css/styles.css" rel="stylesheet" type="text/css" />
    <script src="/scripts/jquery-1.7.1.js" type="text/javascript"></script>
    <script src="/scripts/knockout-2.0.0.js" type="text/javascript"></script>
    <script src="/js/data.js" type="text/javascript"></script>
    <script src="/js/01-ko-anonymous-and-script-template.js" type="text/javascript"></script>
</head>
<body>
    <div class="page">
        <div class="header" data-bind="with: metadata">
            <h1 data-bind="text: pageTitle"></h1>
            <div data-bind="with:personal">
                <a href="00-index.html">Index</a> <a data-bind="attr: {href: link, title: text}, text: text"
                                                     class="personalCss"></a>
            </div>
        </div>
        <div id="main">
            <div class="leftFloat">
                <div>
                    <span class="caption">Select a Product</span>
                </div>
                <ul class="smallList" data-bind="foreach:products">
                    <li data-bind="css: {selected: isSelected}" class="selectable">
                        <div data-bind="text: shortDesc, click:$root.selectProduct">
                        </div>
                    </li>
                </ul>
            </div>
            <!-- ko if: selectedProduct -->
            <div class="leftFloat">
                <div class="productDetailsArea">
                    <!-- ko template: {name: 'productDetails'}-->
                    <!-- /ko -->
                </div>
            </div>
            <!-- /ko -->
        </div>
    </div>

    <script id="productDetails" type="text/html">
        <div data-bind="with: selectedProduct">
            <div class="photoContainer leftFloat">
                <img src="/images/guitar.jpg" data-bind="attr: {alt: shortDesc}" class="photoThumbnail" />
            </div>
            <div>
                <span>Brand: </span><span data-bind="text: model().brand" class="textValues"></span>
            </div>
            <div>
                <span>Model: </span><span data-bind="text: model().name" class="textValues"></span>
            </div>
            <div>
                <span>Price: </span><span data-bind="text: my.formatCurrency(salePrice())" class="textValues">
                </span>
            </div>
            <div>
                <span>Description:</span>
            </div>
            <div>
                <span data-bind="text: description" class="textValues"></span>
            </div>
        </div>
    </script>
</body>
</html>
